<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>定位</title>
	<style type="text/css">
		div{
			width: 200px;
			height: 200px;
			background: red url() 0 0 no-repeat;
			color: #fff;
			font-size: 40px;
			margin:10px;
			float: left;
		}
		.father{
			width: 100%;
			position: relative;
			background: #A349A4 url() 0 0 no-repeat;
		}
		.box2{
			background: blue url() 0 0 no-repeat;
			position: relative;
			/*相对定位参照物是自己，原来位置保留*/
			top: 0px;
			left: 10px;
		}
		.box3{
			background: green url() 0 0 no-repeat;
			position: absolute;
			/*完成脱离文档，不会占位置，参考物是逐级向上查找*/
			top: 100px;
			left: 100px;
			z-index: 100;
		}
		.box4{
			background: yellow url() 0 0 no-repeat;
			position: absolute;
			top: 0px;
			left: 0px;
			z-index: -1;
		}


	</style>
</head>
<body>
	<p>学并思</p>
	<p>学并思</p>
	<p>学并思</p>

	<p>学并思</p>
	<p>学并思</p>
	<p>学并思</p>
	<p>学并思</p>
	<p>学并思</p>
	<div class="father">
		<div class="box1">1</div>
		<div class="box2">2</div>
		<div class="box3">3</div>
		<div class="box4">4</div>
	</div>
</body>
</html>